def insert_sort(arr):
    print(f'初始arr{arr}')
    for i in range(1, len(arr)):
        if arr[i] < arr[i-1]:
            insert_num = arr[i]
            for j in range(i-1, -1, -1):
                if arr[j] > insert_num:
                    arr[j + 1] = arr[j]
                    if j - 1 < 0:
                        arr[j] = insert_num
                else:
                    arr[j + 1] = insert_num
                    break
            print(f'插入排序{arr}')
    return arr


arr = [10, 5, 16, 7, 32, 83, 64, 55, 21]
insert_sort(arr)